package com.zs.diveinspringboot

import org.springframework.boot.SpringApplication
import org.springframework.boot.WebApplicationType
import org.springframework.boot.autoconfigure.SpringBootApplication

/**
 *
 * @description
 * @author madison
 * @date 2021/6/5 11:46
 *
 */

class SpringApplicationBootstrap

@SpringBootApplication
class ApplicationConfiguration

fun main(array: Array<String>) {
//    SpringApplication.run(ApplicationConfiguration::class.java, *array)

//    SpringApplication(ApplicationConfiguration::class.java).run(*array)

    var sources = mutableSetOf<String>()
    sources.add(ApplicationConfiguration::class.java.name)
    sources.add(SpringApplicationBootstrap::class.java.name)
    var springApplication = SpringApplication()
    springApplication.sources.addAll(sources)
//    val sources1 = springApplication.sources
//    sources1.add(ApplicationConfiguration::class.java.name)
//    sources1.add(SpringApplicationBootstrap::class.java.name)
//    sources1.addAll(sources)
    springApplication.webApplicationType = WebApplicationType.NONE
    val context = springApplication.run(*array)
    val bean = context.getBean(SpringApplicationBootstrap::class.java)
    println("Bean:$bean")
}